package com.dal.producer.controller;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class ProducerDemo {
    @Resource
    private RocketMQTemplate rocketMQTemplate;
    @GetMapping("/push")
    public String push(@RequestParam(defaultValue = "hello world") String msg) {
//        发送信息到mytopic主题
        rocketMQTemplate.convertAndSend("users:push",msg );

        return "ok";
    }

}
